﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ServiceStack.OrmLite;
using LPY.LeHealth.DTO;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;

namespace LPY.LeHealth.DAL
{
    public class ComTophyDAL:GenericBaseDAL<TuanOrderDTO>
    {
       

       /// <summary>
       /// 根据ID获取体检项目
       /// </summary>
       /// <param name="id"></param>
       /// <returns></returns>
       public List<PhysicalItemDTO> GetcomTophy(int id)
       {
           using (var cnn = DbConnection)
           {
               var sql = cnn.From<ComboToPhysicalItemDTO>()
                   .Where(m => m.ComboId== id);
               var rtv = cnn.Select(sql);
               if (rtv.Count < 1)
               {
                   return null;
               }
               var pId=from n in rtv
                       select n.PhysicalItemId;
               var sql2=cnn.From<PhysicalItemDTO>()
                   .Where(m=>Sql.In(m.Id,pId));
               var result=cnn.Select(sql2).ToList();
               return result;
           }
          
       }
    }
}
